home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
A-Monthly Disks
/
(c)aai.d64
/
merrimanager 3.2
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
8KB
|
237 lines
5 REM LIST 3000-
15 REM*********************************
20 REM* MERRIMANAGER 3.2 *
25 REM* RE=MAX. # OF RECORDS:- *
30 REM* NOW SET AT 300. *
35 REM*DOES NOT RETAINS ORIGINAL ORDER*
40 REM* WHEN SAVED TO DISK. *
45 REM* DOES NOT PRINT RECORD NUMBERS *
50 REM*********************************
80 RE=300:FE=10:R=0:O$="BRFEADPLSCNM\X":DN$=""
90 DIMD$(RE,FE),D%(RE),FT$(FE):FI$="NEW FILE":PRINTCHR$(142)
96 :
98 REM** WARM START **
100 POKE53281,15:POKE646,11:CLOSE15:OPEN15,8,15
102 POKE53280,12:M=0:GOTO900
103 :
106 REM** SORT **
108 T=D%(K):D%(K)=D%(I):D%(I)=T:RETURN
110 PRINT"[147] SORT [146][144]"
112 PRINT"":FORK=1TOF:PRINT" "K"[157] [146] "FT$(K):NEXT
114 PRINT"ENTER NUMBER SHOWING":PRINT"CATEGORY TO SORT"
116 INPUT"(0 TO QUIT) 0[157][157][157]";FC:IFFC=0THENRETURN
118 IFFC>FTHENPRINT"[145][145][145]":GOTO116
120 PRINT"[147] SORTING PLEASE WAIT":M=2^INT(LOG(R)/LOG(2))-1
122 FORJ=1TOR-M:I=J
124 K=I+M:IFD$(D%(I),FC)>D$(D%(K),FC)THENGOSUB108:I=I-M:IFI>.THEN124
126 NEXT:M=INT(M/2):IFM>.THEN122
128 RETURN
196 :
198 REM** LOAD **
200 PRINT"[147] LOAD FILE [146][144]":FK$=FI$
201 FI$=""
202 PRINT" 'RETURN' TO CANCEL [146]"
203 PRINT"ENTER FILE NAME";:INPUT" [157][157][157]";FI$:IFFI$=""THENFI$=FK$:RETURN
204 CLOSE8:OPEN8,8,8,"0:MM/"+FI$+",S,R":INPUT#15,E,A$:IFETHENFI$=FK$:GOTO938
205 PRINTLEFT$(DN$,21)" PLEASE WAIT "
208 INPUT#8,FI$:INPUT#8,F:FORI=1TOF:INPUT#8,FT$(I):NEXT
210 FORI=1TORE:PRINTLEFT$(DN$,10)"READING RECORD # "I
212 D%(I)=I:FORJ=1TOF:INPUT#8,D$(I,J):NEXT:L=ST
214 IFL=.THENNEXT
216 IFL=64THENR=I:GOTO220
218 PRINT"BAD STATUS"L:FORX=1TO3000:NEXT:GOTO200
220 I=RE:NEXT:CLOSE8:RETURN
296 :
298 REM** SAVE **
300 PRINT"[147] SAVE [146][144]"
302 PRINT"EXISTING FILE: "FI$
304 PRINT" 'RETURN' TO CANCEL "
306 PRINT"ENTER FILE NAME <= 13 CHARACTERS":INPUTZ$:IFZ$=""THENRETURN
308 IFZ$=FI$THENINPUT"SCRATCH ORIGINAL FILE N[157][157][157]";A$:IFA$="N"THENRETURN
310 IFZ$=FI$THENPRINT#15,"S0:MM/"+FI$:PRINT"OLD "CHR$(34)Z$CHR$(34)" SCRATCHED"
312 INPUT#15,E,A$:IFE<>0ANDE<>1ANDE<>73THEN938
314 CLOSE8:OPEN8,8,8,"0:MM/"+Z$+",S,W":INPUT#15,E,A$:IFETHEN938
316 FI$=Z$:PRINT#8,FI$:PRINT#8,F:FORI=1TOF:PRINT#8,FT$(I):NEXTI
318 FORI=1TOR:FORJ=1TOF:IFD$(I,J)=""THEND$(I,J)="\"
320 PRINT#8,D$(D%(I),J):NEXTJ
322 PRINTLEFT$(DN$,14)"WRITING RECORD #"I
324 PRINT"OF NEW FILE "CHR$(34)FI$CHR$(34):NEXTI
326 CLOSE8:RETURN
396 :
398 REM** FIELD TITLES **
400 PRINT"[147] NEW OR ADD OR CHANGE FIELD TITLES [144]"
401 PRINT" 'RETURN' TO CANCEL "
402 A=0:PRINT"ENTER NUMBER OF FIELDS"
403 PRINT"PER RECORD ( 1-"FE"):";:INPUTA$:IFVAL(A$)>FETHEN400
404 IFVAL(A$)=0THENRETURN
405 F=VAL(A$):PRINT"ENTER FIELD TITLES:"
406 FORI=1TOF:PRINTI;:INPUT"[157]";FT$(I):NEXT:RETURN
496 :
498 REM** BROWSE **
500 PRINT"[147] BROWSE [146][144]"
501 INPUT"BEGIN AT RECORD # 1[157][157][157]";S
502 IFS>RTHENPRINT" ONLY "R" RECORDS ":GOTO1005
503 FORJ=STOR
504 GOSUB550
506 PRINT""TAB(29)" C [146]ONTINUE":PRINTTAB(29)" Q [146]UIT";
507 INPUT"[144] C[157][157][157]";A$:IFA$="Q"THENJ=R
508 NEXTJ:RETURN
550 PRINT"[147]RECORD #"J:FORK=1TOF:PRINTLEFT$(DN$,2*K+3)""FT$(K)
552 PRINTRIGHT$(" "+STR$(K),3)". "D$(D%(J),K):NEXTK:RETURN
596 :
598 REM** FIND **
600 PRINT"[147] FIND A RECORD [144]"
601 FU=0:S$=""
602 FORK=1TOF:PRINT" "K"[157] [146]"FT$(K):NEXT
603 PRINT"ENTER LINE # SHOWING":PRINT"CATEGORY TO SEARCH";:INPUT" 0[157][157][157]";FU
604 IFFU=0THENRETURN
606 IFFU>FTHENPRINT"[145][145][145][145][145][145]":GOTO603
610 INPUT"ENTER SEARCH VALUE";S$
612 L=LEN(S$):IFS$=""THENPRINT"[145][145]":GOTO610
620 FORJ=1TOR:IFLEFT$(D$(D%(J),FU),L)=S$THEN504
622 NEXT:RETURN
716 :
718 REM** ADD **
720 PRINT"[147] ADDING RECORD #"R+1"[157] ";
721 IF(R+1)<100THENPRINT" ";:IF(R+1)<10THENPRINT" ";
722 PRINT"[144] 'RETURN' TO CANCEL [146]"
724 R=R+1:D%(R)=R:J=R:FORK=1TOF:D$(R,K)="":NEXT
726 FORI=1TOF:PRINTLEFT$(DN$,2*I+3)""FT$(I)
728 PRINTRIGHT$(" "+MID$(STR$(I),2),2)" .[157]";
730 INPUTD$(D%(J),I):IFLEFT$(D$(D%(J),1),1)=""THENR=R-1:D%(R)=R:J=R:RETURN
732 IFD$(D%(J),I)=""THEND$(D%(J),I)="\"
734 Z=0:IFSW=1THENSW=0:RETURN
736 NEXT
740 INPUT"ENTER LINE # OF ANY CHANGES: 0[157][157][157]";I:IFI>FTHENPRINT"[145][145]";:GOTO740
743 IFI=0THENRETURN
746 SW=1:PRINT""LEFT$(DN$,2*I+4);
748 GOSUB728:GOTO740
756 :
758 REM** EDIT & DELETE **
760 PRINT"[147] DELETE RECORD [146][144]"
761 IFI=4THENPRINT"[147] EDIT RECORD [146][144]"
762 INPUT"ENTER RECORD # 0[157][157][157]";J
763 IFJ=0THENRETURN
764 IFJ<1ORJ>RTHENPRINT"[145][145]";:GOTO760
765 GOSUB550:IFI=4THENZ=4:GOTO740:REM * EDIT *
778 PRINT" CAUTION NON RETRIEVABLE DELETE[144]"
780 DC$="M":INPUT" D [146]ELETE OR M [146]ENU M[157][157][157]";DC$
782 IFLEFT$(DC$,1)="M"THENRETURN
786 TE=D%(J):FORI=JTOR-1:D%(I)=D%(I+1):NEXT
788 FORK=1TOF:D$(TE,K)=D$(R,K):D$(R,K)="":NEXT
790 FORI=1TOR-1:IFD%(I)=RTHEND%(I)=TE:I=R
792 NEXT:D%(R)=0:R=R-1:PRINT"[147]OLD RECORD #"J"DELETED":GOTO1005
796 :
798 REM** PRINT **
800 PRINT"[147] PRINT RECORDS [146][144]"
801 OPEN12,4,15:CLOSE12:IFST<>0THENPRINT"[156]TURN ON PRINTER AND PRESS RETURN[144]"
803 IFST<>0THENGETA$:IFA$<>CHR$(13)THEN803
804 INPUT"ENTER STARTING RECORD # [157][157][157]";S:IFS=0THENS=1
805 IFS>RTHEN807
806 PRINT"ENDING RECORD # 0";:INPUT"[157][157][157]";E:IFE<SORE=0THENPRINT" ERROR":GOTO1005
807 IFE>RORS>RTHENPRINT"[147] ONLY"STR$(R)" RECORDS ENTERED":GOTO1005
808 PRINT"[156]DO YOU WANT A TITLE? Y/N"
810 GETT$:IFT$=""THEN810
812 IFT$="Y"THEN PRINT"[144]PLEASE ENTER TITLE":INPUTC$
814 PRINT"[147]PRINT RECORDS[146][144]"
816 PRINT"HOLD <SPACE BAR> TO PAUSE"
818 CLOSE4:OPEN4,4:IFT$="Y"THENPRINT#4,CHR$(14)SPC(20-(LEN(C$)/2));C$:C$=""
820 PRINT#4,CHR$(15):PRINT#4,CHR$(17)
822 FORI=STOE
824 FORJ=1TOF:PRINT#4,D$(D%(I),J):NEXTJ
826 GETA$:IFA$=CHR$(32)THEN830
828 PRINT#4:GOSUB2000:NEXTI:CLOSE4:RETURN
830 PRINT"TO CONTINUE PRESS <C>":PRINT"TO END PRINT PRESS <E>"
832 GETA$:IFA$=""THEN832
834 IFA$="E"THENPRINT#4:CLOSE4:RETURN
836 IFA$="C"THENPRINT"[145][145][145] ":PRINT" ":GOTO828
838 GOTO832
896 :
898 REM** MENU **
900 PRINT"[147] MERRIMANAGER 3.2 [146]";
901 PRINT" [156] FILE: "FI$" [146][144]":PRINTR"/"RE
902 PRINT" C [146] CHANGE HEADINGS OR START RECORDS"
903 PRINT" L [146] LOAD OR S [146] SAVE THE RECORDS"
904 PRINT" F [146] FIND OR E [146] EDIT A RECORD"
905 PRINT" A [146] ADD OR D [146] DELETE A RECORD"
906 PRINT" B [146] BROWSE THRU RECORDS"
907 PRINT" R [146] REARRANGE THE RECORDS (SORT)"
908 PRINT" P [146] PRINT THE RECORDS"
909 PRINT" M [146] MEMORY CHECK \ [146] DIRECTORY"
910 PRINT" X [146] EXIT PROGRAM N [146] NEW FILE
911 [153]" ENTER OPTION WAIT ?"
912 [161]A$:[139]A$[178]""[167]912
914 [129]J[178]1[164]14:[139][202](O$,J,1)[178]A$[167]I[178]J:J[178]14:[130]:[137]918
916 [130]:[137]912
918 [139]I[178]8[176]I[178]10[176]I[178]12[176]I[178]13[176]I[178]14[167]922
919 [139]I[178]5[175]F[177]0[167]922
920 [139]R[178]0[167][153]"LOAD NO RECORDS IN MEMORY STOP L OR STOP C STOP":[137]901
922 [145]I[141]500,110,600,760,720,760,800,200,300,400,1012,996,1052,1080
924 [137]900
934 :
936 [143]** DISK ERROR **
938 [153]"LOAD ERROR ON DISKSTOP":[153]"";A$:[160]8:[160]15:[159]15,8,15,"U;"
940 [153][200](DN$,19):[133]"PRESS 'RETURN' KEY";A$:[142]
992 :
994 [143]** MEMORY **
996 [153]"LOAD MEMORY CHECK WAIT"
998 [153]"STOPPLEASE WAIT - FORCED GARBAGE COLLECTION"
1000 [153]"TAKE A BREAK - BELL WILL SOUND
1002 PRINT""FRE(0)"[157] [146]SPACES REMAIN":C=0:GOSUB2070
1005 PRINTLEFT$(DN$,21)"[144] PRESS 'RETURN' KEY";:INPUTA$:RETURN
1008 :
1010 REM** NEW FILE **
1012 PRINT"[147] ERASE ALL RECORDS IN MEMORY AND RE-RUN [144]"
1014 INPUT" ARE YOU SURE Y/N N[157][157][157]";A$
1016 IFA$="Y"THENRUN
1018 RETURN
1048 :
1050 REM** DISK DIRECTORY **
1052 CLOSE8:OPEN8,8,0,"$0":INPUT#15,E,A$:IFETHEN938
1054 PRINT"[147] DATA FILE DIRECTORY [146][144]":C=0:D$=""
1056 GET#8,A$,A$
1058 GET#8,A$,A$:IFA$=""THENCLOSE8:GOTO1070
1060 GET#8,A$:IFA$<>""THEND$=D$+A$:GOTO1060
1062 IFMID$(D$,2,3)="MM/"THENA=5:GOTO1068
1064 IFMID$(D$,3,3)="MM/"THENA=6:GOTO1068
1066 D$="":GOTO1058
1068 PRINTMID$(D$,A,A+9):C=C+1:D$="":GOTO1058
1070 IFC=0THENPRINT"NO DATA FILES ON THIS DISK"
1072 GOTO1005
1076 :
1078 REM** EXIT PROGRAM **
1080 PRINT"[147] ANY RECORDS WILL BE ERASED "
1082 IFF>0THENINPUT"[144]HAVE YOU SAVED THE RECORDS Y/N N[157][157][157]";A$
1084 IFF=0THENINPUT"[144]ARE YOU SURE Y/N N[157][157][157]";A$
1088 IFA$="Y"THENCLOSE4:CLOSE8:CLOSE15
1089 IFA$="Y"THENPRINT"[147] ALL FILES CLOSED.":END
1090 RETURN
1980 :
1990 REM** AUTO PAGEING **
2000 IFI=STHENLI=63:RM=0:IFT$="Y"THENLI=62
2020 RM=RM+1:BAL=LI-RM*(F+1)
2025 IFBAL<FTHEN2050
2040 RETURN
2050 FORK=1TOBAL+2:PRINT#4,CHR$(13);
2060 NEXTK:LI=63:RM=0:RETURN
2068 REM** BELL **
2070 FORC=1TO3
2075 POKE54296,15:POKE54276,33:POKE54277,9:POKE54278,0
2080 POKE54273,51:POKE54272,97:FORD=1TO300:NEXT
2082 POKE54276,0:POKE54296,0:NEXT:RETURN
2090 END
3000 :
3002 : THIS IS A PUBLIC DOMAIN PROGRAM
3004 : RELEASED INTO THE PUBLIC DOMAIN
3006 : IN 1986 BY:
3008 :
3010 : REX MERRITT
3012 : 2101 TRIMBLE ST.
3014 : VANCOUVER, B.C.
3016 : CANADA, V6R 4H5
3018 :
3020 : IF YOU HAVE ANY QUESTIONS,
3022 : COMMENTS, OR SUGGESTIONS ABOUT
3024 : THIS PROGRAM, PLEASE FEEL FREE
3026 : TO WRITE.